$(function(){
	/*console.log("start")
	function geetdata(url, opation, htmlurl, scripturl, isLog) {
		$.getJSON(url, opation, function(json){
			if(isLog) {
				console.log("json.data")
				console.info(json.data);
				console.info("json数据是");
				console.log(json);
			}

			  view(json,  htmlurl, scripturl);
		})
	}
	function view(json, htmlurl, scripturl) {
		var $varietyContent = $(htmlurl),
	  	varietyHtml = template(scripturl, json);
		$varietyContent.html(varietyHtml);
		
	}*/
	
	// 填充 集团要闻列表
	var par = {
			cid:101,
			status:1,
			pageNo:1,
			pageSize:4
	};
	geetdata("../article/pagelist.do", par, "#cl3new", "jtyw_list", false);
	
	// 填充 综合新闻列表 102
	var par = {
			cid:102,
			status:1,
			pageNo:1,
			pageSize:3
	};
	geetdata("../article/pagelist.do", par, "#xNwe", "zhxw_list",'zonghexinwen', false);
	
	// 填充  深度报道
	var par = {
			cid:103,
			status:1,
			pageNo:1,
			pageSize:4
	};
	// geetdata("../article/list.do", par, "#bText", "sdbd_list", false);
	
	$.getJSON("../article/list.do", par,function(json){
		view(json, "#bText", "sdbd_list");
		(function(){
	        var oBScroll=document.getElementById('scroll');
	        var oPre=document.getElementById('clickP');
	        var oNext=document.getElementById('clickN');

	        var oBBox=document.getElementById('bMax');
	        var oBText=document.getElementById('bText');
	        /*var maxContTop=oBText.offsetHeight-parseInt(getStyle(oBBox,'height'));*/
	        var maxContTop=oBText.offsetHeight-oBBox.offsetHeight;
	        var maxSTop=oBScroll.parentNode.offsetHeight-oBScroll.offsetHeight;
	        var top=0;

	        oBScroll.onmousedown=function(ev){
	            var oEvent=ev || event;
	            var disY=oEvent.clientY-oBScroll.offsetTop;

	            document.onmousemove=function(ev){
	                var oEvent=ev || event;
	                top=oEvent.clientY-disY;

	                if(top<0){
	                    top=0;
	                }else if(top>maxSTop){
	                    top=maxSTop;
	                }
	                oBScroll.style.top=top+'px';
	                var nContTop=top/maxSTop*maxContTop;
	                oBText.style.top=-(nContTop)+'px';
	            };

	            document.onmouseup=function(){
	                document.onmousemove=null;
	                document.onmouseup=null;

	                oBScroll.releaseCapture && oBScroll.releaseCapture();
	            };
	            oBScroll.setCapture && oBScroll.setCapture();
	            return false;
	        };

	        oNext.onmousedown=function(){
	            top+=40;

	            if(top>maxSTop){
	                top=maxSTop;
	            }
	            oBScroll.style.top=top+'px';
	            var nContTop=top/maxSTop*maxContTop;
	            oBText.style.top=-(nContTop)+'px'
	        };

	        oPre.onmousedown=function(){
	            top-=40;

	            if(top<0){
	                top=0;
	            }
	            oBScroll.style.top=top+'px';
	            var nContTop=top/maxSTop*maxContTop;
	            oBText.style.top=-(nContTop)+'px'
	        };

	        function getStyle(obj, sName){
	            return (obj.currentStyle || getComputedStyle(obj, false))[sName];
	        }
	    })();
	})
	  
	  
	
	// 填充 鸿鑫网谈   104
	var par = {
			cid:104,
			status:1,
			pageNo:1,
			pageSize:6
	};
	geetdata("../article/pagelist.do", par, "#hxwt", "hxwt_list", false);
	
	// 填充  专题报道
	var par = {
			cid:105,
			status:1,
			pageNo:1,
			pageSize:6
	};
	geetdata("../article/pagelist.do", par, "#ztbd", "ztbd_list", false);
	
	// 填充  特别关注--(媒体关注) 
	var par = {
			cid:5,
			status:1,
			pageNo:1,
			pageSize:1
	};
	//geetdata("../articledetail/pagelist.do", par, "#l4aLone1", "tbgz_list", true);
	test2();
	function test2(){
		var par = {
				cid:5,
				status:1,
				pageNo:1,
				pageSize:4
		};
		$.getJSON("../articledetail/pagelist.do", par, function(json){
			// 日志打印模块
//			if(false) {
//				console.log("在geetdata函数中opation:");
//				console.info(opation);
//				console.log("在geetdata函数中接收的json.data");
//				console.info(json.data);
//				console.info("在geetdata函数中接收的json数据是");
//				console.log(json);
//			}

			  view(json,  "#l4aLone1", "tbgz_list"); // 负责界面显示数据
			  
			  (function(){
			        var oTcard=document.getElementById('l4aLone1');
			        var aTDl=oTcard.getElementsByTagName('dl');
			        var aTUl=oTcard.getElementsByTagName('li');

			        for(var i=0; i<aTUl.length; i++){
			            (function(index){
			                aTUl[i].onmouseover=function(){
			                    for(var j=0; j<aTUl.length; j++){
			                        aTUl[j].className='';
			                        aTDl[j].className='clearFix';
			                    }
			                    this.className='listLi';
			                    aTDl[index].className='showDl clearFix'
			                };
			            })(i);
			        }
			    })();
			 
		})
	}
	
	// 填充  独家策划 106
	var par = {
			cid:106,
			status:1,
			pageNo:1,
			pageSize:4
	};
	// geetdata("../articledetail/pagelist.do", par, "#l4aLone", "djch_list", false);
	
	test1();
	function test1(){
		var par = {
				cid:106,
				status:1,
				pageNo:1,
				pageSize:4
		};
		$.getJSON("../articledetail/pagelist.do", par, function(json){
			// 日志打印模块
//			if(false) {
//				console.log("在geetdata函数中opation:");
//				console.info(opation);
//				console.log("在geetdata函数中接收的json.data");
//				console.info(json.data);
//				console.info("在geetdata函数中接收的json数据是");
//				console.log(json);
//			}

			  view(json,  "#l4aLone", "djch_list"); // 负责界面显示数据
			  
			  (function(){
			        var oTcard=document.getElementById('l4aLone');
			        var aTDl=oTcard.getElementsByTagName('dl');
			        var aTUl=oTcard.getElementsByTagName('li');
			        for(var i=0; i<aTDl.length; i++){
			            (function(index){
			                aTUl[i].onmouseover=function(){
			                    for(var j=0; j<aTUl.length; j++){
			                        aTUl[j].className='';
			                        aTDl[j].className='clearFix';
			                    }
			                    this.className='listLi';
			                    aTDl[index].className='showDl clearFix'
			                };
			            })(i);
			        }
			    })();
			 
		})
	}
	
	
	
})